package com.chezai.client.bean;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.chezai.client.dao.DaoSession;
import com.chezai.client.dao.UserInfoDao;
import com.chezai.client.dao.CoachLoginRecordDao;

/**
 * 教练登录记录
 * Created by likunyang on 2017/9/22.
 */
@Entity
public class CoachLoginRecord {
    @Id(autoincrement = true)
    private Long _ID;
    //对应人员信息表中的_ID
    private Long cid;
    //教学类型 科一，科四，科二科三 Const.TrainPart
    private int teachSubject;
    //教学项目
    private String projectCode;

    private String projectName;
    //yyMMdd;
    private String createDay;
    //登录时间 时间戳
    private Long signInTime;
    //签退时间 时间戳
    private Long signOutTIme;
    @ToOne(joinProperty = "cid")
    private UserInfo coachInfo;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 696834276)
    private transient CoachLoginRecordDao myDao;
    @Generated(hash = 699941971)
    public CoachLoginRecord(Long _ID, Long cid, int teachSubject,
            String projectCode, String projectName, String createDay,
            Long signInTime, Long signOutTIme) {
        this._ID = _ID;
        this.cid = cid;
        this.teachSubject = teachSubject;
        this.projectCode = projectCode;
        this.projectName = projectName;
        this.createDay = createDay;
        this.signInTime = signInTime;
        this.signOutTIme = signOutTIme;
    }
    @Generated(hash = 1870752043)
    public CoachLoginRecord() {
    }
    public Long get_ID() {
        return this._ID;
    }
    public void set_ID(Long _ID) {
        this._ID = _ID;
    }
    public Long getCid() {
        return this.cid;
    }
    public void setCid(Long cid) {
        this.cid = cid;
    }
    public int getTeachSubject() {
        return this.teachSubject;
    }
    public void setTeachSubject(int teachSubject) {
        this.teachSubject = teachSubject;
    }
    public String getProjectCode() {
        return this.projectCode;
    }
    public void setProjectCode(String projectCode) {
        this.projectCode = projectCode;
    }
    public String getProjectName() {
        return this.projectName;
    }
    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }
    public String getCreateDay() {
        return this.createDay;
    }
    public void setCreateDay(String createDay) {
        this.createDay = createDay;
    }
    public Long getSignInTime() {
        return this.signInTime;
    }
    public void setSignInTime(Long signInTime) {
        this.signInTime = signInTime;
    }
    public Long getSignOutTIme() {
        return this.signOutTIme;
    }
    public void setSignOutTIme(Long signOutTIme) {
        this.signOutTIme = signOutTIme;
    }
    @Generated(hash = 852413597)
    private transient Long coachInfo__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 109315992)
    public UserInfo getCoachInfo() {
        Long __key = this.cid;
        if (coachInfo__resolvedKey == null
                || !coachInfo__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            UserInfoDao targetDao = daoSession.getUserInfoDao();
            UserInfo coachInfoNew = targetDao.load(__key);
            synchronized (this) {
                coachInfo = coachInfoNew;
                coachInfo__resolvedKey = __key;
            }
        }
        return coachInfo;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1423296200)
    public void setCoachInfo(UserInfo coachInfo) {
        synchronized (this) {
            this.coachInfo = coachInfo;
            cid = coachInfo == null ? null : coachInfo.get_ID();
            coachInfo__resolvedKey = cid;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1249018590)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getCoachLoginRecordDao() : null;
    }
    


}
